nyc_inspections = read_csv("./data/DOHMH_New_York_City_Restaurant_Inspection_Results.csv.gz", 
                           col_types = cols(building = col_character()),
                           na = c("NA", "N/A"))

nyc_inspections =
  nyc_inspections %>%
  filter(grade %in% c("A", "B", "C"), boro != "Missing") %>% 
  mutate(boro = str_to_title(boro)) 

bar chart

nyc_inspections %>% 
  count(boro) %>% 
  plot_ly(x= ~boro, y = ~n, color = ~boro, type = "bar") %>% 
    layout(xaxis = list(title = "", tickangle = -45),
         yaxis = list(title = ""),
         margin = list(b = 100),
         barmode = 'group')

boxplot

nyc_inspections %>% 
  mutate(cuisine_description = fct_reorder(cuisine_description, score)) %>% 
  plot_ly(y = ~score, color = ~cuisine_description, type = "box",
          colors = "Set2") %>% 
  layout(xaxis = list(title = "", tickangle = -45),
         yaxis = list(title = ""),
         margin = list(b = 100),
         barmode = 'group')
## Warning: Ignoring 3 observations
nyc_inspections %>%
  group_by(grade_date) %>% 
  plot_ly(x = ~grade_date, y = ~n, type = "scatter", mode = "lines", line = list(color = 'rgba(67,67,67,1)', width = 2))
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone 'default/America/
## New_York'